
if [ $1 = '2' ]; then

  echo "===== Git Add ==="
  git add -A

  echo "=== Git Commit ==="
  git commit -m "${2:- feat}: ${3:- auto script push}"

  exit 0
fi

current_branch=$(git rev-parse --abbrev-ref HEAD)

if [ $1 = '3' ]; then

  echo "===== Git Add ==="
  git add -A

  echo "=== Git Commit ==="
  git commit -m "${2:- feat}: ${3:- auto script commit}"

  echo "=== Git Pull ==="
  git pull origin  ${3:- $current_branch}

  exit 0
fi


echo "=== Git Add ==="
git add -A

echo "=== Git Commit ==="
git commit -m "${1:- feat}: ${2:- auto script commit}"

echo "=== Git Pull ==="

git pull origin  ${3:- $current_branch}

if  ! git diff --quiet --exit-code; then
  echo "=== File Conflict Found ==="
  exit 1
fi

echo "=== Git Push ==="
git push origin  ${3:- $current_branch}

echo "=== Script Finished ==="
